package com.snail.app.gather.service;

import com.snail.common.entity.Page;
import com.snail.app.gather.entity.DataSyncSendPath;
import com.snail.app.gather.rep.DataSyncSendPathRep;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;
import java.util.Optional;

/**
 * @description
 * @date 2021/11/18
 * @autor houyanfeng
 */
@Service
@Transactional
public class DataSyncSendPathService {

    @Autowired
    private DataSyncSendPathRep dataSyncSendPathRep;
    @Value("${spring.profiles.active}")
    private String env;

    public Page list(Page page, Map<String,Object> params){
        return dataSyncSendPathRep.execHqlPage(page, "from DataSyncSendPath");
    }

    public DataSyncSendPath getByKey(String id) {
        Optional optional = dataSyncSendPathRep.findById(id);
        if (optional.isPresent()) {
            return (DataSyncSendPath) optional.get();
        }
        return null;
    }
    public void save(DataSyncSendPath entity) {
        dataSyncSendPathRep.save(entity);
    }

    public void del(String id){
        dataSyncSendPathRep.deleteById(id);
    }
}
